#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
char* myStrncpy(char* dest, const char* src, int n)
{
	int i = 0;
	for (i = 0; i < n && src[i] != '\0'; i++)
	{
		dest[i] = src[i];
	}
	if (i<n)
	{
		dest[i] = '\0';
	}
	return dest;
}

int main()
{
	char dest[] = "abced";
	const char* src = "abc";

	char* ret = myStrncpy(dest, src, 2);
	printf("%s", ret);
	return 0;
}